
<?php

function dal_message_list($user_id)
{
}

function dal_message_read($user_id, $msg_id)
{
	$t_conn   = dal_mocool_get_dbconn();
	$t_sql    = "update mocool_message_table set readflag=1 where user_id=$user_id and msg_id=$msg_id";
	$t_result = mysql_query($t_sql, $t_conn);
	if (!$t_result) {
		dal_mysql_error($t_conn, $t_sql, __FUNCTION__);
		return false;
	}
	return true;
}

function dal_message_send($user_id, $name, $to_id, $to_name, $content)
{
	$t_conn   = dal_mocool_get_dbconn();
	$content  = mysql_escape_string($content);
	$t_sql    = "insert into mocool_message_table(user_id, from_id, from_name, content) values($to_id, $user_id, '$name', '$content')";
	$t_result = mysql_query($t_sql, $t_conn);
	if (!$t_result) {
		dal_mysql_error($t_conn, $t_sql, __FUNCTION__);
		return false;
	}
	$t_sql = "insert into mocool_message_history_table(user_id, to_id, to_name, content) values($user_id, $to_id, '$to_name', '$content')";
	if (!$t_result) {
		dal_mysql_error($t_conn, $t_sql, __FUNCTION__);
		return false;
	}
	return true;
}

function dal_message_delete($user_id, $msg_id)
{
}

?>
